﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace RL.Wcf
{
    [DataContract]
    public abstract class BaseDataContract
    {
        [DataMember]
        public string[] Errors { get; set; }

        private bool hasError = false;
        [DataMember]
        public bool HasError
        {
            get
            {
                hasError = this.Errors.CountedPositive();
                return hasError;
            }
            set
            {
                hasError = value;
            }
        }

        bool isSuccess = true;
        [DataMember]
        public bool IsSuccess
        {
            get
            {
                isSuccess = this.Errors.CountedZero();
                return isSuccess;
            }
            set 
            {
                isSuccess = value;
            }
        }
    }
}
